﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {

            String str = null;
            if(str == null || str.Length < 1)
            {
                str = "yejing";
            }
            int l = str.Length; // 如果上面不初始化，就会报System.NullReferenceException:“未将对象引用设置到对象的实例。”
            Console.WriteLine(l);

            Console.ReadKey();
        }
    }
}
